<@override name="head">
<title>分配权限</title>
<script type="text/javascript" src="${ctx}/assets/js/lib/bootstrap.min.js"></script>
<script type="text/javascript" src="${ctx}/assets/js/lib/bootbox.js"></script>
<script type="text/javascript" src="${ctx}/assets/js/layer/layer.js"></script>
<script type="text/javascript" src="${ctx}/assets/js/common/table.js"></script>
<script type="text/javascript" src="${ctx}/assets/js/back/role.js"></script>
</@override>
<@override name="body">
<div id=content_bg>
<#include "/main/home/common.ftl"/>
    <div id= "pagecontent" style="padding-bottom:30px;">
    	<div id="content">
   			<div id="navDiv">
				<ul id="navDiv_ul">
					<li><i class="icon-home"></i></li>
					<li><a href="${ctx}/back/main/dashboard">首页</a></li>
					<li><i class="icon-angle-right"></i></li>
				    <li><a href="${ctx}/back/main/role/list">角色管理</a></li>
					<li><i class="icon-angle-right"></i></li>
					<li class="navDiv_currentLi">分配权限</li>
				</ul>  
 			</div>
 			<form id="permissionForm" action="${ctx}/back/main/role/savePermission" method="post">
 				<input name="roleId" type="hidden" value="${roleId!}"/>
 				<input id="resRoles" name="resRoles" type="hidden" value="${resRoles!}"/>
 				<table border="1" class="permissionTable">
 					<thead>
				        <tr class="theadTr">
				        	<th class="theadTh" style="width:20%;">目录</th>
							<th class="theadTh" style="width:80%;"><span>菜单</span><span class="buttonTh">按钮</span></th>
				        </tr>
				    </thead>
				    <tbody>
				    	<#if resourcesList ??>
		                <#list resourcesList as resources>
				        <tr id="tbodyTr">
							<td class="tbodyTd">
								<div class="rootResource">
									<input type="checkbox" id="${resources.resKey!}_${resources.id!}" name="${resources.resKey!}" value="${resources.id!}"/>
									<label class="checkbox-label" for="${resources.resKey!}_${resources.id!}">${resources.name!}</label>
								</div>
							</td>
							<td class="tbodyTd">
							<div class="menu">
							<#if resources.children ??>
		                	<#list resources.children as menu>
								<div class="menu-item">
									<div class="menu-checkbox">
										<input type="checkbox" id="${menu.resKey!}_${menu.id!}" name="${menu.resKey!}" value="${menu.id!}" parentId="${menu.parentId!}"/>
										<label class="checkbox-label" for="${menu.resKey!}_${menu.id!}">${menu.name!}</label>
									</div>
									<div class="menu-button">
									<#if menu.children ??>
		                			<#list menu.children as button>
										<div class="button-checkbox">
											<input type="checkbox" id="${button.resKey!}_${button.id!}" name="${button.resKey!}" value="${button.id!}" parentId="${button.parentId!}"/>
											<label class="checkbox-label" for="${button.resKey!}_${button.id!}">${button.name!}</label>
										</div>
									</#list>
									</#if>
									</div>
								</div>
							</#list>
							</#if>
							</div>
							</td>
				        </tr>
				     	</#list>
						</#if> 
					 </tbody>  
 				</table>
 				<div id="footPersimissionBtn">
					<button class="btn-save" type="submit">保存</button>
					<button class="btn-cancel" id="btn-cancel-authority" type="button">取消</button>
				</div>
 			</form>
		</div>
	</div>
</div>
</@override>
<@extends name="/common/simple.ftl"/>